<?php

/**
 * 核心处理<p/>
 * @catepory 【核心框架】核心处理器
 * @author zhouhaichao(a)2008.sina.com
 * @version 1.0
 * @copyright (c) 2008
 * @date 2013-2-21
 */

//系统定义宏
include_once(ROOT . '/system/core/constants.php');
//导入系统定义的fun
include_once(ROOT . '/system/function/system.php');

include_once(ROOT . '/system/core/Config.class.php');
include_once(ROOT . '/system/core/Request.class.php');

//异常控制
include_once(ROOT . '/system/core/ErrorHandler.class.php');

//配置文件导入
include_once(ROOT . '/system/core/Controller.class.php');
include_once(ROOT . '/system/core/ActionInvoker.class.php');
include_once(ROOT . '/system/core/ViewRenderer.class.php');

//自动导入模块
include_once(ROOT . '/system/core/autoload.php');

//用户定义宏
if (file_exists(ROOT . '/application/config/constants.php')) {
    include_once(ROOT . '/application/config/constants.php');
}

//用户自动导入功能
if (file_exists(ROOT . '/application/config/autoload.php')) {
    include_once(ROOT . '/application/config/autoload.php');
}
// 配置信息
$conf = Config::getInstance();
if (!defined("HTDOCS")) {
    define("HTDOCS", $conf->getConfig("htdocs", "/htdocs"));
}
if( !defined("DEBUG") ){
    define("DEBUG",$conf->getConfig("debug",false));
}
$requestClass = $conf->getConfig("request","Request");
// 请求信息
$request = newInstance($requestClass);
$ret = ActionInvoker::invoke($request, $conf);
ViewRenderer::showRenderer($request, $conf, $ret);